package types

import (
	"context"
	"gitee.com/enjoy_5/goods-rpc/internal/server"
	"gitee.com/enjoy_5/goods-rpc/proto/types"
)

type TypeHandler struct {
	types.UnimplementedTypesServer
}

func (s *TypeHandler) GetTypeListByLocation(ctx context.Context, req *types.GetTypeListByLocationReq) (*types.GetTypeListByLocationResp, error) {
	// 调用 GetTypesByLocation 函数
	resp, err := server.GetTypesByLocation(req.Location, req.ID)
	if err != nil {
		return nil, err
	}

	return &types.GetTypeListByLocationResp{
		In: resp,
	}, nil
}
